<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>五指山污水处理系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/huazhi/lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/huazhi/css/public.css" media="all">
    <link rel="shortcut icon" href="<%=request.getContextPath()%>/huazhi/images/favicon.ico"/>
    <link rel="stylesheet" href="<%=request.getContextPath()%>/css/logincss/layout.css" media="all">
</head>
<style>
    /* 底部固定区域 */
    .layui-layout-admin .layui-footer {
        padding: 10px 0;
        text-align: center;
    }

    .layui-layout-admin .layui-footer {
        background-color: #fff;
    }
    .layui-form-label{
        width: 85px;
        position: relative;
        margin-left: -5px;
    }

</style>
<body>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <form class="layui-form" lay-filter="component-form-element" id="form" method="post" enctype="multipart/form-data">
                <input type="hidden" name="tid" id="tid">
                <div class="layui-tab-content" style="height: auto">

                    <div class="layui-row">
                        <div class="layui-col-lg4">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">乡镇</label>
                                    <div class="layui-input-block">
                                        <select disabled  id="xz-select" name="xz" lay-filter="xz-select"
                                                class="layui-input">
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-lg4">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">村委会</label>
                                    <div class="layui-input-block">
                                        <select disabled name="cwh" lay-filter="cwh-select" id="cwh-select"
                                                class="layui-input">
                                        </select>
                                    </div>
                                </div>
                            </div>

                        </div>
                        <div class="layui-col-lg4">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">自然村</label>
                                    <div class="layui-input-block">
                                        <select disabled name="zrc" lay-filter="zrc-select" id="zrc-select"
                                                class="layui-input">
                                        </select>
                                    </div>
                                </div>
                            </div>

                        </div>

                    </div>



                    <div class="layui-row">
                        <div class="layui-col-lg4">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">设备型号</label>
                                    <div class="layui-input-block">
                                        <input disabled type="text" id="sbxh" name="sbxh" lay-verify="sbxh"
                                               autocomplete="off" placeholder="请输入设备型号"
                                               class="layui-input">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-lg4">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">巡查日期</label>
                                    <div disabled class="layui-input-block">
                                        <input disabled type="text" name="xcrqString" lay-verify="xcrqString" id="xcrqString"
                                               autocomplete="off" placeholder="请输入巡查日期"
                                               class="layui-input">
                                    </div>
                                </div>
                            </div>

                        </div>
                        <div class="layui-col-lg4">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">工作人员</label>
                                    <div class="layui-input-block">
                                        <%--                                        <div  name="gzrySel" lay-verify="gzry" id="gzrySel"></div>--%>
                                        <%--                                        <input name="gzry" id="gzry" type="hidden">--%>
                                        <input disabled type="text" name="gzry" lay-verify="gzry" id="gzry" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    设备运行情况
                    <hr>
                    <div class="layui-row">
                        <div class="layui-col-lg3">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">供电</label>
                                    <div class="layui-input-block">
                                        <%--                                        <div   id="gdSel" name="gdSel" lay-verify="gd">--%>
                                        <%--                                        </div>--%>
                                        <%--                                        <input id="gd" name="gd" type="hidden" value="">--%>
                                        <input disabled type="text" name="gd" lay-verify="gd" id="gd" autocomplete="off" class="layui-input">

                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-lg3">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">提升泵</label>
                                    <div class="layui-input-block">
                                        <%--                                        <div   name="tsbSel" lay-verify="tsb" id="tsbSel" >--%>
                                        <%--                                        </div>--%>
                                        <%--                                        <input name="tsb" id="tsb" type="hidden">--%>
                                        <input disabled type="text" name="tsb" lay-verify="tsb" id="tsb" autocomplete="off" class="layui-input">

                                    </div>
                                </div>
                            </div>

                        </div>
                        <div class="layui-col-lg3">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">产水泵</label>
                                    <div class="layui-input-block">
                                        <%--                                        <div   name="csbSel" lay-verify="csb" id="csbSel" >--%>

                                        <%--                                        </div>--%>
                                        <%--                                        <input name="csb" id="csb" type="hidden">--%>
                                        <input disabled type="text" name="csb" lay-verify="csb" id="csb" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="layui-col-lg3">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">机油</label>
                                    <div class="layui-input-block">
                                        <%--                                        <div  name="jySel" lay-verify="jy" id="jySel">--%>
                                        <%--                                        </div>--%>
                                        <%--                                        <input name="jy" id="jy" type="hidden">--%>
                                        <input disabled type="text" name="jy" lay-verify="jy" id="jy" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="layui-row">
                        <div class="layui-col-lg3">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">皮带</label>
                                    <div class="layui-input-block">
                                        <%--                                        <div  id="pdSel" name="pdSel" lay-verify="pd" >--%>
                                        <%--                                        </div>--%>
                                        <%--                                        <input name="pd" id="pd" type="hidden">--%>
                                        <input disabled type="text" name="pd" lay-verify="pd" id="pd" autocomplete="off" class="layui-input">

                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-lg3">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">显示屏</label>
                                    <div class="layui-input-block">
                                        <%--                                        <div   name="xspSel" lay-verify="xsp" id="xspSel" >--%>
                                        <%--                                        </div>--%>
                                        <%--                                        <input name="xsp" id="xsp" type="hidden">--%>
                                        <input disabled type="text" name="xsp" lay-verify="xsp" id="xsp" autocomplete="off" class="layui-input">

                                    </div>
                                </div>
                            </div>

                        </div>
                        <div class="layui-col-lg3">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">连接管</label>
                                    <div class="layui-input-block">
                                        <%--                                        <div  name="ljgSel" lay-verify="ljg" id="ljgSel">--%>
                                        <%--                                        </div>--%>
                                        <%--                                        <input name="ljg" id="ljg" type="hidden">--%>
                                        <input disabled type="text" name="ljg" lay-verify="ljg" id="ljg" autocomplete="off" class="layui-input">

                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="layui-col-lg3">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">反洗泵</label>
                                    <div class="layui-input-block">
                                        <%--                                        <div  name="fxbSel" lay-verify="fxb" id="fxbSel" >--%>
                                        <%--                                        </div>--%>
                                        <%--                                        <input name="fxb" id="fxb" type="hidden">--%>
                                        <input disabled type="text" name="fxb" lay-verify="fxb" id="fxb" autocomplete="off" class="layui-input">

                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="layui-row">
                        <div class="layui-col-lg12">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">工作内容</label>
                                    <div class="layui-input-block">
                                        <input disabled type="text" id="gznr" name="gznr" lay-verify="gznr"
                                               autocomplete="off" placeholder="请输入工作内容"
                                               class="layui-input">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>


                    <div class="layui-row">
                        <div class="layui-col-lg6">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">设备维修日期</label>
                                    <div class="layui-input-block">
                                        <input disabled type="text" id="sbwxrqString" name="sbwxrqString" lay-verify="sbwxrqString"
                                               autocomplete="off" placeholder="请输入设备维修日期"
                                               class="layui-input">
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="layui-col-lg6">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">设备维修人员</label>
                                    <div class="layui-input-block">
                                        <%--                                        <div  id="sbwxrySel" name="sbwxrySel" lay-verify="sbwxry">--%>
                                        <%--                                            <input name="sbwxry" id="sbwxry" type="hidden">--%>
                                        <%--                                        </div>--%>
                                        <input disabled type="text" name="sbwxry" lay-verify="sbwxry" id="sbwxry" autocomplete="off" class="layui-input">

                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="layui-row">
                            <div class="layui-col-lg12">
                                <div class="layui-form-item">
                                    <div class="layui-col-xs12">
                                        <label class="layui-form-label">故障描述</label>
                                        <div class="layui-input-block">
                                            <input disabled type="text" id="gzms" name="gzms" lay-verify="gzms"
                                                   autocomplete="off" placeholder="请输入故障描述"
                                                   class="layui-input">
                                        </div>
                                    </div>
                                </div>
                            </div>

                        </div>

                        <div class="layui-row">
                            <div class="layui-col-lg12">
                                <div class="layui-form-item">
                                    <div class="layui-col-xs12">
                                        <label class="layui-form-label">修复情况</label>
                                        <div class="layui-input-block">
                                            <input disabled type="text" id="xfqk" name="xfqk" lay-verify="xfqk"
                                                   autocomplete="off" placeholder="请输入修复情况"
                                                   class="layui-input">
                                        </div>
                                    </div>
                                </div>
                            </div>

                        </div>

                        <div class="layui-row">
                            <div class="layui-col-lg3">
                                <div class="layui-form-item">
                                    <div class="layui-col-xs12">
                                        <label class="layui-form-label">管网巡查情况</label>
                                        <div class="layui-input-block">
                                            <input disabled type="text" id="gwxcqk" name="gwxcqk" lay-verify="gwxcqk"
                                                   autocomplete="off" placeholder="请输入管网巡查情况"
                                                   class="layui-input">
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="layui-col-lg9">
                                <div class="layui-form-item">
                                    <div class="layui-col-xs12">
                                        <label class="layui-form-label">备注</label>
                                        <div class="layui-input-block">
                                            <input disabled type="text" id="bz" name="bz" lay-verify="bz"
                                                   autocomplete="off" placeholder="请输入备注"
                                                   class="layui-input">
                                        </div>
                                    </div>
                                </div>
                            </div>

                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-col-lg6" id="image">
                            <div class="layui-col-xs12">
                                <label class="layui-form-label">相关图片</label>
                                <span class="layui-btn layui-btn-primary">选择图片
                                          <input disabled type="file" id="uploadImg" class="uploadImg" name="uploadImage" multiple="multiple">
                                        </span>
                            </div>
                        </div>
                    </div>
                </div>

            </form>

        </div>
    </div>
</div>
<script src="<%=request.getContextPath()%>/huazhi/lib/layui-v2.5.5/layui.all.js"></script>
<script src="<%=request.getContextPath()%>/huazhi/js/lay-config.js?v=1.0.4" charset="utf-8"></script>
<script>
    function child(tid) {
        layui.use(['form', 'laydate', 'layer', 'xmSelect'], function () {
            var $ = layui.$
                , form = layui.form
                , laydate = layui.laydate
                , layer = layui.layer
                , xmSelect = layui.xmSelect;

            var fromxData;

            laydate.render({
                elem: '#sbwxrqString' //指定元素
            });
            laydate.render({
                elem: '#xcrqString' //指定元素
            });


            $.ajax({
                type: "get",
                url: "<%=request.getContextPath()%>/rest/base/getXzglSelect",
                dataType: "json",
                async: false,
                data: {
                    xzzdId: -1
                },
                success: function (msg) {
                    document.getElementById("xz-select").options.length = 0;
                    var content = '<option value="">请选择乡镇</option>';
                    var xzSelect = $("#xz-select");
                    for (var i = 0; i < msg.xzzdList.length; i++) {
                        content += '<option value="' + msg.xzzdList[i].id + '">' + msg.xzzdList[i].title + '</option>';
                        ;
                    }
                    xzSelect.append(content)
                    form.render()
                }

            })


            //监听乡镇select
            form.on('select(xz-select)', function (data) {
                jianTingxz(data.value)
            })

            function jianTingxz(value) {
                //给村委会赋值
                var cwhselect = $("#cwh-select");
                $.ajax({
                    type: "post",
                    url: "<%=request.getContextPath()%>/rest/base/getXzglSelect",
                    dataType: "json",
                    async: false,
                    data: {
                        'xzzdId': value,
                    },
                    success: function (msg) {
                        document.getElementById("cwh-select").options.length = 0;
                        var content = '<option value="">请选择村委会</option>';
                        var cwhSelect = $("#cwh-select");
                        for (var i = 0; i < msg.xzzdList.length; i++) {
                            content += '<option value="' + msg.xzzdList[i].id + '">' + msg.xzzdList[i].title + '</option>';
                            ;
                        }
                        cwhSelect.append(content)
                        form.render();
                    }
                })

            }


            //监听村委会select
            form.on('select(cwh-select)', function (data) {
                jianTingcwh(data.value)
            })


            function jianTingcwh(value) {
                //给自然村赋值
                var cwhselect = $("#zrc-select");
                $.ajax({
                    type: "post",
                    url: "<%=request.getContextPath()%>/rest/base/getZrcs",
                    dataType: "json",
                    async: false,
                    data: {
                        'xzzdId': value,
                    },
                    success: function (msg) {
                        var content = ""
                        document.getElementById("zrc-select").options.length = 0;
                        if (msg.xzzdList.length > 0) {
                            content = '<option value="">请选择自然村</option>';
                        } else {
                            content = '<option value="">没有可选择的自然村</option>';
                        }
                        var zrcSelect = $("#zrc-select");
                        for (var i = 0; i < msg.xzzdList.length; i++) {
                            content += '<option value="' + msg.xzzdList[i].id + '">' + msg.xzzdList[i].title + '</option>';
                            ;
                        }
                        zrcSelect.append(content)
                        form.render();
                    }
                })
            }


            $.ajax({
                type: "get",
                url: "<%=request.getContextPath()%>/rest/base/getCircuitByTid",
                dataType: "json",
                data: "tid=" + tid,
                async: false,
                success: function (msg) {

                    if (msg) {
                        jianTingxz(msg.xz)
                        jianTingcwh(msg.cwh)
                        form.render()
                        form.val("component-form-element", msg)
                    }

                }
            })

        });
    }

</script>
</body>
</html>